<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
error_reporting(-1);
//echo generateTableName();
/*$p = (int)'10000001';
echo strlen($p);
var_dump(is_int($p));



$tmp = NULL;
var_dump( (int)$tmp  );
*/
//$href ="www.taobao.com/auction/item_detail.htm";
//$href = "item.taobao.com/auction/item_detail.htm?item_num_id=4657618849";
 $href = "www.abc.com/?kkn=www.taobao.com/auction/item_detail.htm";
preg_match('/^[^\/]+\.taobao\.com\/?.+/', $href, $m);
var_dump($m);exit;


$html = '<a target="_blank" href="http://rate.taobao.com/user-rate-25d917d9de0d991d71b6285987e195c8.htm">目美瑞希</a>';
preg_match('/<a.+href="http:\/\/rate\.taobao\.com\/user-rate-(.+)\.htm.*>(.+)<\/a>/', $html, $m1);
var_dump($m1);

//$str = "dksfjiosafjhttp://www.nowpei.com/q/webdt/p/b05fc8ff-c3a9-4fa2-8bb6-ce5193dff2a9着哦你paj
//faiof的撒旦撒的谎哦iauwkyitew【你usdhapigh大三角发放军嫂ifiy  http://shop59025263.taobao.com hufdsaioduoiajfsaiefhdksajfjsafjsaifjoi";

//preg_match('/[a-zA-z]+:\/\/[^\s]*/', $str, $m);
//var_dump($m);

echo "<br />adler32: ".hash('adler32', md5("dadsadasdJ100sdfsfsfsafsafsaf00001a113"));
echo "<br />crc32: ".crc32(md5("J1000000sadfsafda1a11dasdasdasdasagrrhtrhkpkp]]]]]3"));

function generateTableName($str=NULL){
    $arr = str_split($str, 1);
    if( FALSE === $arr OR empty($arr[0]) ){
        return 'a';
    }

    $plus = 1;
    for($i=count($arr)-1; $i>=0; $i--){
        $base = ord($arr[$i]) + $plus;
        if( $base == 122 ){
            $arr[$i] = 'a';
            $plus = 1;
        }else{
            $arr[$i] = chr($base);
            $plus = 0;
        }
    }
    $result = implode('', $arr);   
    return (1==$plus) ? 'a'.$result : $result;
}



?>
